#include <wfcClient.h>
#include <uifcDefaultListeners.h>
#include <pfcGlobal.h>
#include <wxyutils.h>
#include <MyListener.h>

wfcStatus BatchExport()
{
    try
    {
        pfcSession_ptr session = pfcGetProESession();
        xstring workdir = session->GetCurrentDirectory();
        //创建窗口
        xstring DialogName = "BatchExport";
        xstring DialogFilename = DialogName + ".res";
        uifcCreateDialog(DialogName, DialogFilename);
        uifcDialog_ptr ExportDialog = uifcDialogFind(DialogName, DialogName);
        ExportDialog->AddActionListener(new CloseDialogListener());
        //创建按钮
        uifcPushButton_ptr btn_workdir = uifcPushButtonFind(DialogName, "btn_workdir");
        btn_workdir->AddActionListener(new SelectDir("ip_workdir", true));
        uifcInputPanel_ptr ip_workdir = uifcInputPanelFind(DialogName, "ip_workdir");
        ip_workdir->SetTextValue(workdir); //预设为工作目录
        ip_workdir->AddActionListener(new MyInputPanelListener());

        uifcPushButton_ptr btn_outdir = uifcPushButtonFind(DialogName, "btn_outdir");
        btn_outdir->AddActionListener(new SelectDir("ip_outdir"));
        uifcInputPanel_ptr ip_outdir = uifcInputPanelFind(DialogName, "ip_outdir");
        ip_outdir->SetTextValue(workdir); //预设为工作目录

        uifcOptionMenu_ptr op_type = uifcOptionMenuFind(DialogName, "op_type");
        op_type->AddActionListener(new MyOptionMenuListener());

        uifcPushButton_ptr btn_retrieve = uifcPushButtonFind(DialogName, "btn_retrieve");
        btn_retrieve->AddActionListener(new MyPushButtonListener(BTN_GET_LIST));
        uifcPushButton_ptr btn_begin = uifcPushButtonFind(DialogName, "btn_begin");
        btn_begin->AddActionListener(new MyPushButtonListener(BTN_START));
        uifcPushButton_ptr btn_close = uifcPushButtonFind(DialogName, "btn_close");

        btn_close->AddActionListener(new MyPushButtonListener());
        uifcList_ptr list_export = uifcListFind(DialogName, "list_export");
        list_export->AddActionListener(new MyListListener());

        uifcActivateDialog(DialogName);
        // GetList(DialogName);
        uifcDestroyDialog(DialogName);
    }
    OTK_EXCEPTION_PRINT_LOG
    return wfcTK_NO_ERROR;
}